package com.asiainfo.ssm.execute.dao.impl;

import java.util.HashMap;

import com.asiainfo.ssm.execute.bo.BOExecFileLogBean;
import com.asiainfo.ssm.execute.bo.BOExecFileLogEngine;
import com.asiainfo.ssm.execute.dao.interfaces.IExecFileLogDAO;
import com.asiainfo.ssm.execute.ivalues.IBOExecFileLogValue;

public class ExecFileLogDAOImpl implements IExecFileLogDAO {

	@Override
	public void saveExecFileLog(IBOExecFileLogValue value) throws Exception {
		if(value.isNew()){
			value.setLogId(BOExecFileLogEngine.getNewId().longValue());
			
		} 
		BOExecFileLogEngine.save(value);
	}

	@Override
	public IBOExecFileLogValue getExecFileLogByName(String fileName) throws Exception {
	   String condition = " FILE_NAME =:fileName ";
	   HashMap param = new HashMap();
	   param.put("fileName", fileName);
	   IBOExecFileLogValue[] beans = BOExecFileLogEngine.getBeans(condition, param);
	   if(beans!=null && beans.length >0){
		   return beans[0];
	   }else{
		   return null;
	   }
	}

}
